/* 选择完成度 */
export const tabControlMixin = {
  data () {
    return {
      dataList: [
        { name: '形式作业1', process: '已完成', class: 'work',classes: '' },
        { name: '形式作业3', process: '未完成', class: 'work' },
      ],
      list: [],
    };
  },
  created () {
    this.list = this.dataList;
  },
  mounted () {
    const tag = document.querySelectorAll('.tag-icon');
    const status = document.querySelectorAll('.status');

    for (let i = 0; i < this.list.length; i++) {
      if (status[i].innerText == '已完成' && tag[i].classList.contains('exam')) {
        tag[i].classList.add("exam_ok")
      }

      if (status[i].innerText == '已完成' && tag[i].classList.contains('work')) {
        tag[i].classList.add("work_ok")
      }
    }
  },
  methods: {
    cleItemClick (index) {
      switch (index) {
        case 0:
          this.list = this.dataList;
          break;
        case 1:
          this.processList = [];
          for (const item of this.dataList) {
            if (item.process == '已完成') {
              this.processList.push(item);
            }
          }
          this.list = this.processList;
          break;
        case 2:
          this.processList = [];
          for (const item of this.dataList) {
            if (item.process == '未完成') {
              this.processList.push(item);
            }
          }
          this.list = this.processList;
          break;
      }
    },

    listClick (index) {
      console.log(index);
    },
  }
};

/* 选项选择 */
export const topicSelect = {
  data () {
    return {
      radioIndex: [{ flag: '' }],

    };
  },
  created () {
    this.radioIndex = [];
    for (let i = 0; i < this.judgeTopic.length; i++) {
      var item = { flag: '' };
      this.radioIndex.push(item);
    }
    console.log(this.radioIndex);
  },
  methods: {
    selectClick (index, cIndex) {
      console.log(index, cIndex);
      this.radioIndex[cIndex].flag = index;
    },
  },
}